﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Data.SqlClient;
using System.Data.SqlTypes;

namespace LibrarySystem
{
    public partial class Director_form : Form
    {
        SqlConnection Connection_Main = new SqlConnection();
        //string str;
        AppManager LIB = new AppManager();

        //==========================##1
        string User;
        //==========================##1
        public Director_form(string Name)//##1
        {
            InitializeComponent();
            //str = "integrated security=SSPI;" + "data source='.';" + "initial catalog='alssafa'";
            //Connection_Main.ConnectionString = str;
            //Connection_Main.Open();
            
            
            //==========================##1
            User = Name;
            //==========================##1
        }

        int a, b;

        private void button1_Click(object sender, EventArgs e)
        {
            Form1 F1 = new Form1();
            F1.Show();
            this.Hide();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if ((MessageBox.Show("هل تريد الخروج من البرنامج؟", "خروج", MessageBoxButtons.YesNo)) == System.Windows.Forms.DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void Director_form_Load(object sender, EventArgs e)
        {
            TimeLogin.Text = DateTime.Now.ToLongTimeString();
            day.Text = DateTime.Now.DayOfWeek.ToString();
            date.Text = DateTime.Now.Date.ToShortDateString();
            //this.reportViewer_SO_ADDED.RefreshReport();
            //==========================##1
            UserName.Text = User;
            //==========================##1
        }

        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if ((MessageBox.Show("هل تريد الخروج من البرنامج؟", "خروج", MessageBoxButtons.YesNo)) == System.Windows.Forms.DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Form1 F1 = new Form1();
            F1.Show();
            this.Hide();
        }

        private void label13_Click(object sender, EventArgs e)
        {

        }

        private void label31_Click(object sender, EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void BookNameCheck_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void AuthorName_Delete_TextChanged(object sender, EventArgs e)
        {
           
        }

        private void Cost_Delete_TextChanged(object sender, EventArgs e)
        {
           
        }

        private void SSN_Delete_TextChanged(object sender, EventArgs e)
        {
            label175.Text = "";
        }

        private void label24_Click(object sender, EventArgs e)
        {

        }

        private void comboBox28_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            label173.Text = "";
        }

        //=======================================================================================
        //=======================================================================================
        //=======================================الموظفين=======================================
        private void tabPage8_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(Name_Delete, "select * from alssafa.dbo.EMPLOYEE ", "EMPLOYEE", "الإسم");
            Name_Delete.Text = "اختر الإسم";
            label175.Text = "";
            SSN_Delete.Text = "الرقم القومى";
        }
        //===================
        private void tabPage8_MouseEnter(object sender, EventArgs e)
        {

        }
        //===================
        private void tabPage8_MouseMove(object sender, MouseEventArgs e)
        {

        }
        //===================
        private void tabPage1_Click(object sender, EventArgs e)
        {

        }
        //===================
        private void tabControl2_Click(object sender, EventArgs e)
        {
            Name_Delete.Text = "اختر الإسم";
            Name_Edit.Text = "اختر الإسم";
        }
        //===================
        private void tabPage9_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(Name_Edit, "select الإسم from alssafa.dbo.EMPLOYEE ", "EMPLOYEE", "الإسم");
            Name_Edit.Text = "اختر الإسم";
            textBox2.Text = "الرقم القومى";
            Phone_Edit.Text = "";
            Address_Edit.Text = "";
            Email_Edit.Text = "";
            //JOB_Edit.Text = "";
            Salary_Edit.Text = "";
        }
        //===================
        private void OK_Edit_Click(object sender, EventArgs e)
        {
            label173.Text = "";
            if (textBox2.Text != "الرقم القومى" && textBox2.Text.Length > 0)
            {
             if (Phone_Edit.Text.Length !=0)
             {

                if (Phone_Edit.Text.Length <= 11 && Phone_Edit.Text.Length >= 7)
                {
                     if (Address_Edit.Text.Length !=0) 
                {
                         if (JOB_Edit.Text.Length >0) 
                {

                    if (Salary_Edit.Text.Length >= 3 && Salary_Edit.Text.Length != 0)
                        {
                           
                                
                                dataGridView1.ClearSelection();
                                LIB.update("UPDATE EMPLOYEE SET الهاتف=" + Phone_Edit.Text + " where  الرقم_القومي=" + textBox2.Text + "");
                                LIB.update("UPDATE EMPLOYEE SET  العنوان='" + Address_Edit.Text + "' where  الرقم_القومي=" + textBox2.Text + "");
                                LIB.update("UPDATE EMPLOYEE SET البريد_الاكتروني='" + Email_Edit.Text + "'where  الرقم_القومي=" + textBox2.Text + "");
                                LIB.update("UPDATE EMPLOYEE SET  الوظيفة='" + JOB_Edit.Text + "' where  الرقم_القومي=" + textBox2.Text + "");
                                LIB.update("UPDATE EMPLOYEE SET الراتب_الشهري=" + Salary_Edit.Text + " where  الرقم_القومي=" + textBox2.Text + "");
                                LIB.GridDisplay(dataGridView1, "EMPLOYEE", "select الإسم,الرقم_القومي,الوظيفة,العنوان,الراتب_الشهري,الهاتف,تاريخ_الميلاد,البريد_الاكتروني from EMPLOYEE");
                                Phone_Edit.Clear();
                                Address_Edit.Clear();
                                Email_Edit.Clear();
                                JOB_Edit.Refresh();
                                Salary_Edit.Clear();
                                
                                LIB.ComboDisplay(Name_Edit, "select الإسم from alssafa.dbo.EMPLOYEE ", "EMPLOYEE", "الإسم");
                                Name_Edit.Text = "اختر الإسم";
                                textBox2.Text = "الرقم القومى";
                                label173.Text = "تمت عملية التعديل";

                            }
                            else
                                label173.Text = "قم بإدخال الراتب الشهري";
                }
                         else
                             label173.Text = "قم بأختيار الوظيفة";
                        }
                        else
                            label173.Text = "قم بإدخال العنوان";
                    }
                    else
                        label173.Text = "رقم الهاتف غير صحيح";

                }
             else
                 label173.Text = "قم بإدخال الهاتف";
            }
            else
                label173.Text = "قم باختيار الإسم";

        }
        //===================
        private void tabPage9_Click(object sender, EventArgs e)
        {
            //***
            //LIB.ComboDisplay(Name_Edit, "select الإسم from alssafa.dbo.EMPLOYEE ", "EMPLOYEE", "الإسم");
            //Name_Edit.Text = "اختر الإسم";
            //textBox2.Text = "الرقم القومى";
            //Phone_Edit.Text = "";
            //Address_Edit.Text = "";
            //Email_Edit.Text = "";
            ////JOB_Edit.Text = "";
            //Salary_Edit.Text = "";

        }
        //===================
        private void Name_Edit_SelectedIndexChanged(object sender, EventArgs e)
        {
            label173.Text = "";
            LIB.ComboDisplayChoose(comboBox10, "Select * from EMPLOYEE where الإسم = " + "'" + Name_Edit.Text + "'", "EMPLOYEE", "الرقم_القومي", textBox2);
            LIB.ComboDisplayChoose(comboBox21, "Select * from EMPLOYEE where الإسم = " + "'" + Name_Edit.Text + "'", "EMPLOYEE", "الهاتف", Phone_Edit);
            LIB.ComboDisplayChoose(comboBox22, "Select * from EMPLOYEE where الإسم = " + "'" + Name_Edit.Text + "'", "EMPLOYEE", "العنوان", Address_Edit);
            LIB.ComboDisplayChoose(comboBox23, "Select * from EMPLOYEE where الإسم = " + "'" + Name_Edit.Text + "'", "EMPLOYEE", "البريد_الاكتروني", Email_Edit);
            LIB.ComboDisplayChoose2(comboBox24, "Select * from EMPLOYEE where الإسم = " + "'" + Name_Edit.Text + "'", "EMPLOYEE", "الوظيفة", JOB_Edit);
            LIB.ComboDisplayChoose(comboBox25, "Select * from EMPLOYEE where الإسم = " + "'" + Name_Edit.Text + "'", "EMPLOYEE", "الراتب_الشهري", Salary_Edit);
        }
        //===================
        private void OK_Add_Click(object sender, EventArgs e)
        {
            if (SSN_ADD.Text.Length !=0)
            {
            if (SSN_ADD.Text.Length == 14)
            {
                if (Name_ADD.Text.Length != 0)
                {
                     if (JOB_ADD.Text.Length > 0)
                {
                    if (Address_ADD.Text.Length != 0)
                    {
                        if (Salary_ADD.Text.Length >= 3)
                        {
                            if (PhoneNumber_ADD.Text.Length !=0)
                            {
                            if (PhoneNumber_ADD.Text.Length <= 11 && PhoneNumber_ADD.Text.Length >= 7)
                            {
                                if (PassWord_ADD.Text.Length !=0)
                            {
                                label137.Text = "";
                                dataGridView1.ClearSelection();
                                LIB.insert("insert into [alssafa].[dbo].[EMPLOYEE] values (" + SSN_ADD.Text + ",'" + Name_ADD.Text + "','" + JOB_ADD.Text + "','" + Address_ADD.Text + "'," + Salary_ADD.Text + "," + PhoneNumber_ADD.Text + ",'" + DateOfBarth_ADD.Text + "','" + PassWord_ADD.Text + "','" + Email_ADD.Text + "');");
                                LIB.GridDisplay(dataGridView1, "EMPLOYEE", "select الإسم,الرقم_القومي,الوظيفة,العنوان,الراتب_الشهري,الهاتف,تاريخ_الميلاد,البريد_الاكتروني from EMPLOYEE");

                                SSN_ADD.Clear();
                                Name_ADD.Clear();
                                JOB_ADD.Refresh();
                                Address_ADD.Clear();
                                Salary_ADD.Clear();
                                PhoneNumber_ADD.Clear();
                                DateOfBarth_ADD.Refresh();
                                PassWord_ADD.Clear();
                                Email_ADD.Clear();
                            }
                                else
                                    label137.Text = "قم بادخال كلمة المرور";

                            }
                            else
                                label137.Text = "رقم الهاتف غير صحيح";
                            }
                            else
                                label137.Text = "قم بادخال الهاتف";
                        }
                        else label137.Text = "قم بإدخال الراتب الشهري";
                    }
                    else
                        label137.Text = "قم بإدخال العنوان";
                }
                     else
                         label137.Text = "قم باختيار الوظيفة";
                }
                else
                    label137.Text = "قم بإدخال اسم الموظف";
            }
            else
                label137.Text = " الرقم القومى غير صحيح قم بادخال 14 رقم";
            }
            else
                label137.Text = "  قم بادخال الرقم القومى";

           
        }
        //===================
        private void Name_Delete_SelectedIndexChanged(object sender, EventArgs e)
        {
            //label175.Text = "";
                LIB.ComboDisplayChoose(comboBox7, "Select * from EMPLOYEE where الإسم = '" + Name_Delete .Text+ "'", "EMPLOYEE", "الرقم_القومي", SSN_Delete);
        }
        //===================
        private void OK_Delete_Click(object sender, EventArgs e)
        {

            //dataGridView1.ClearSelection();
            //LIB.delete("DELETE from EMPLOYEE  where الإسم='" + Name_Delete.Text + "'");
            //LIB.GridDisplay(dataGridView1, "EMPLOYEE", "select * from EMPLOYEE");
            //MessageBox.Show("تمت عملية الحذف");
            //LIB.ComboDisplay(Name_Delete, "select الإسم from alssafa.dbo.EMPLOYEE ", "EMPLOYEE", "الإسم");
            //Name_Delete.Text = "اختر الإسم";
            //SSN_Delete.Text = "الرقم القومى";
            if (SSN_Delete.Text != "الرقم القومى")
            {
                if (SSN_Delete.Text.Length > 0)
                {
                    dataGridView1.ClearSelection();
                    LIB.delete("DELETE from EMPLOYEE  where الرقم_القومي =" + SSN_Delete.Text + "");
                    LIB.GridDisplay(dataGridView1, "EMPLOYEE", "select الإسم,الرقم_القومي,الوظيفة,العنوان,الراتب_الشهري,الهاتف,تاريخ_الميلاد,البريد_الاكتروني from EMPLOYEE");
                    //label175.Text = "تمت عملية الحذف";
                    LIB.ComboDisplay(Name_Delete, "select * from alssafa.dbo.EMPLOYEE ", "EMPLOYEE", "الإسم");
                    Name_Delete.Text = "اختر الإسم";
                    SSN_Delete.Clear();
                    label175.Text = "تمت عملية الحذف";
                }
                else
                    label175.Text = "اختر اسم الموظف الذي تريد حذفه";
            }
            else
                label175.Text = "اختر اسم الموظف الذي تريد حذفه";

        }
        //===================
        private void tabPage8_Click(object sender, EventArgs e)
        {
            //LIB.ComboDisplay(Name_Delete, "select الإسم from alssafa.dbo.EMPLOYEE ", "EMPLOYEE", "الإسم");
            Name_Delete.Text = "اختر الإسم";
            label175.Text = "";
            SSN_Delete.Text = "الرقم القومى";
        }
        //===================
        private void button4_Click_1(object sender, EventArgs e)
        {
            SSN_ADD.Clear();
            Name_ADD.Clear();
            JOB_ADD.Refresh();
            Address_ADD.Clear();
            Salary_ADD.Clear();
            PhoneNumber_ADD.Clear();
            DateOfBarth_ADD.Refresh();
            PassWord_ADD.Clear();
            Email_ADD.Clear();
        }

        private void tabPage7_Enter(object sender, EventArgs e)
        {
            label137.Text = "";
            SSN_ADD.Clear();
            Name_ADD.Clear();
            JOB_ADD.Refresh();
            Address_ADD.Clear();
            Salary_ADD.Clear();
            PhoneNumber_ADD.Clear();
            DateOfBarth_ADD.Refresh();
            PassWord_ADD.Clear();
            Email_ADD.Clear();
        }
        //=======================================الموظفين=======================================
        //=======================================================================================
        //=======================================================================================

                            //=========================================
                            //=                                       =
                            //=========================================

        //=======================================================================================
        //=======================================================================================
        //=======================================الكتب==========================================

        private void tabPage11_Enter(object sender, EventArgs e)
        {
            label175.Text = "";
            LIB.ComboDisplay(BookName_Delete, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            BookName_Delete.Text = "اختر الكتاب";
            CodeBook_Delete.Text = "كود الكتاب";
            AuthorName_Delete.Text = "";
            Cost_Delete.Text = "";
            Category_Delete.Text = "";
        }
        //=====================
        private void tabControl3_Click(object sender, EventArgs e)
        {
            BookName_Delete.Text = "اختر الكتاب";
            BookName_Edit.Text = "اختر الكتاب";
        }
        //=====================
        private void tabPage12_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(BookName_Edit, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            BookName_Edit.Text = "اختر الكتاب";
            CodeBook_Edit.Text = "كود الكتاب";
            Cost_Edit.Text = "";
            Packing_Edit.Text = "";
            NUN_Carton_Delete.Text = "";
            Total_Edit.Text = "";
        }
        //=====================
        private void tabPage12_Click(object sender, EventArgs e)
        {
            //LIB.ComboDisplay(BookName_Edit, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            //BookName_Edit.Text = "اختر الكتاب";
            //CodeBook_Edit.Text = "كود الكتاب";
            //Cost_Edit.Text = "";
            //Packing_Edit.Text = "";
            //NUN_Carton_Delete.Text = "";
            //Total_Edit.Text = "";
        }
        //=====================
        private void OK2_Edit_Click(object sender, EventArgs e)
        {
            label196.Text = "";

            if (CodeBook_Edit.Text != "كود الكتاب" && CodeBook_Edit.Text.Length > 0 )
            {

                if (Cost_Edit.Text.Length != 0  )
            {
                if (Packing_Edit.Text.Length > 0 && Packing_Edit.Text != "")
                {
                    if (NUN_Carton_Delete.Text.Length > 0 && NUN_Carton_Delete.Text != "")
                    {
                        
                        dataGridView1.ClearSelection();
                        LIB.update("UPDATE BOOKS SET سعر_الكتاب='" + Cost_Edit.Text + "' where  كود_الكتاب='" + CodeBook_Edit.Text + "'");
                        LIB.update("UPDATE BOOKS SET  تعبئة_الكرتونة='" + Packing_Edit.Text + "' where  كود_الكتاب='" + CodeBook_Edit.Text + "'");
                        LIB.update("UPDATE BOOKS SET عدد_الكراتين='" + NUN_Carton_Delete.Text + "'where  كود_الكتاب='" + CodeBook_Edit.Text + "'");
                        LIB.update("UPDATE BOOKS SET اجمالي_النسخ='" + Total_Edit.Text + "'where  كود_الكتاب='" + CodeBook_Edit.Text + "'");

                        LIB.GridDisplay(dataGridView1, "BOOKS", "select * from BOOKS");
                        Cost_Edit.Clear();
                        Packing_Edit.Clear();
                        NUN_Carton_Delete.Clear();
                        Total_Edit.Clear();

                        LIB.ComboDisplay(BookName_Edit, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
                        BookName_Edit.Text = "اختر الكتاب";
                        CodeBook_Edit.Text = "كود الكتاب";
                        label196.Text = "تمت عملية التعديل";
                    }
                    else
                        label196.Text = "أدخل عدد الكراتين";          
                }
                else
                    label196.Text = "أدخل تعبئة الكرتونة";
            }
            else
                label196.Text = "أدخل سعر الكتاب";

            }
            else
                label196.Text = "اختار اسم الكتاب ";
            

        }
        //=====================
        private void Packing_Edit_TextChanged(object sender, EventArgs e)
        {
            Packing_Edit.Enabled = true;
            try
            {
                if (NUN_Carton_Delete.Text == "" || Packing_Edit.Text == "")
                {
                    a = 0;
                    b = 0;
                    Total_Edit.Text = Convert.ToString(a * b);
                }
                else
                {
                    a = int.Parse(Packing_Edit.Text);
                    b = int.Parse(NUN_Carton_Delete.Text);
                    Total_Edit.Text = Convert.ToString(a * b);
                }
            }
            catch (System.FormatException E)
            {
                MessageBox.Show("الرقم المدخل غير صحيح");
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("لا يمكن إدخال هذا الرقم");
            }
        }
        //=====================
        private void NUN_Carton_Delete_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (NUN_Carton_Delete.Text == "" || Packing_Edit.Text == "")
                {
                    a = 0;
                    b = 0;
                    Total_Edit.Text = Convert.ToString(a * b);
                }
                else
                {
                    a = int.Parse(Packing_Edit.Text);
                    b = int.Parse(NUN_Carton_Delete.Text);
                    Total_Edit.Text = Convert.ToString(a * b);
                }
            }
            catch (System.FormatException E)
            {
                MessageBox.Show("الرقم المدخل غير صحيح");
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("لا يمكن إدخال هذا الرقم");
            }
        }
        //=====================
        private void OK2_Delete_Click(object sender, EventArgs e)
        {
            
            if (AuthorName_Delete.Text.Length!=0)
            {

                dataGridView1.ClearSelection();
                LIB.delete("DELETE from BOOKS where إسم_الكتاب='" + BookName_Delete.Text + "'");
                LIB.GridDisplay(dataGridView1, "BOOKS", "select * from BOOKS");

                MessageBox.Show("تمت عملية الحذف");
               
            }

            else
            {
                MessageBox.Show("قم باختيار اسم الكتاب ");
            }

            LIB.ComboDisplay(BookName_Delete, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            BookName_Delete.Text = "اختر الكتاب";
            CodeBook_Delete.Text = "كود الكتاب";
            AuthorName_Delete.Text = "";
            Cost_Delete.Text = "";
            Category_Delete.Text = ""; 
           
        }
        //=====================
        private void BookName_Edit_SelectedIndexChanged(object sender, EventArgs e)
        {
            label196.Text = "";
            LIB.ComboDisplayChoose(comboBox24, "Select * from BOOKS where إسم_الكتاب = " + "'" + BookName_Edit.Text + "'", "BOOKS", "كود_الكتاب", CodeBook_Edit);
            LIB.ComboDisplayChoose(comboBox26, "Select * from BOOKS where إسم_الكتاب = " + "'" + BookName_Edit.Text + "'", "BOOKS", "سعر_الكتاب", Cost_Edit);
            LIB.ComboDisplayChoose(comboBox27, "Select * from BOOKS where إسم_الكتاب = " + "'" + BookName_Edit.Text + "'", "BOOKS", "تعبئة_الكرتونة", Packing_Edit);
            LIB.ComboDisplayChoose(comboBox28, "Select * from BOOKS where إسم_الكتاب = " + "'" + BookName_Edit.Text + "'", "BOOKS", "عدد_الكراتين", NUN_Carton_Delete);

        }
        //=====================
        private void tabPage2_Click(object sender, EventArgs e)
        {
            //LIB.ComboDisplay(BookName_Delete, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب ");
            //BookName_Delete.Text = "اختر الكتاب";
            //CodeBook_Delete.Text = "كود الكتاب";
        }
        //=====================
        private void tabPage11_Click(object sender, EventArgs e)
        {
            //LIB.ComboDisplay(BookName_Delete, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            //BookName_Delete.Text = "اختر الكتاب";
            //CodeBook_Delete.Text = "كود الكتاب";
            //AuthorName_Delete.Text = "";
            //Cost_Delete.Text = "";
            //Category_Delete.Text = "";
        }
        //=====================
        private void CodeBook_Delete_TextChanged(object sender, EventArgs e)
        {

        }
        //=====================
        private void Total_Add_TextChanged(object sender, EventArgs e)
        {

        }
        //=====================
        private void Packing_Add_TextChanged(object sender, EventArgs e)
        {

            Packing_Add.Enabled = true;
            try
            {
                if (NUN_Carton_Add.Text == "" || Packing_Add.Text == "")
                {
                    a = 0;
                    b = 0;
                    Total_Add.Text = Convert.ToString(a * b);
                }
                else
                {
                    a = int.Parse(Packing_Add.Text);
                    b = int.Parse(NUN_Carton_Add.Text);
                    Total_Add.Text = Convert.ToString(a * b);
                }
            }
            catch (System.FormatException E)
            {
                MessageBox.Show("الرقم المدخل غير صحيح");
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("لا يمكن إدخال هذا الرقم");
            }
        }
        //=====================
        private void BookName_Delete_SelectedIndexChanged(object sender, EventArgs e)
        {
            label195.Text = "";
            LIB.ComboDisplayChoose(comboBox3, "Select * from BOOKS where إسم_الكتاب = " + "'" + BookName_Delete.Text + "'", "BOOKS", "كود_الكتاب", CodeBook_Delete);
            LIB.ComboDisplayChoose(comboBox4, "Select * from BOOKS where إسم_الكتاب = " + "'" + BookName_Delete.Text + "'", "BOOKS", "إسم_المؤلف", AuthorName_Delete);
            LIB.ComboDisplayChoose(comboBox5, "Select * from BOOKS where إسم_الكتاب = " + "'" + BookName_Delete.Text + "'", "BOOKS", "سعر_الكتاب", Cost_Delete);
            LIB.ComboDisplayChoose(comboBox6, "Select * from BOOKS where إسم_الكتاب = " + "'" + BookName_Delete.Text + "'", "BOOKS", "التصنيف", Category_Delete);


        }
        //=====================
        private void CodeSuppliers_Add_TextChanged(object sender, EventArgs e)
        {

        }
        //=====================
        private void NUN_Carton_Add_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (NUN_Carton_Add.Text == "" || Packing_Add.Text == "")
                {
                    a = 0;
                    b = 0;
                    Total_Add.Text = Convert.ToString(a * b);
                }
                else
                {
                    a = int.Parse(Packing_Add.Text);
                    b = int.Parse(NUN_Carton_Add.Text);
                    Total_Add.Text = Convert.ToString(a * b);
                }
            }
            catch (System.FormatException E)
            {
                MessageBox.Show("الرقم المدخل غير صحيح");
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("لا يمكن إدخال هذا الرقم");
            }
        }
        //=====================
        private void SuppliersName_AddB_SelectedIndexChanged(object sender, EventArgs e)
        {

            LIB.ComboDisplayChoose(comboBox2, "Select * from Suppliers where إسم_المورد = " + "'" + SuppliersName_AddB.Text + "'", "Suppliers", "كود_المورد", CodeSuppliers_Add);
        }
        //=====================
        private void Volumescode_Add_TextChanged(object sender, EventArgs e)
        {
            LIB.ComboDisplay(SuppliersName_AddB, "select إسم_المورد from alssafa.dbo.Suppliers ", "Suppliers", "إسم_المورد");
            SuppliersName_AddB.Text = "اختر المورد";
            CodeSuppliers_Add.Text = "كود المورد";

        }
        //=====================
        private void BookName_Add_TextChanged(object sender, EventArgs e)
        {


        }
        //=====================
        private void OK2_ADD_Click(object sender, EventArgs e)
        {
            if (CodeBook_Add.Text.Length > 0)
            {
                if (BookName_Add.Text.Length > 0)
                {
                    if (AuthorName_Add.Text.Length > 0)
                    {
                        if (Cost_Add.Text.Length > 0)
                        {
                            if (Category_Add.Text.Length > 0)
                            {
                                if (Volumescode_Add.Text != "كود المجلد" && Volumescode_Add.Text.Length > 0)
                                {
                                        
                                    if (CodeSuppliers_Add.Text != "كود المورد" && CodeSuppliers_Add.Text.Length >0)
                                    {

                                            if (Packing_Add.Text.Length > 0 && Packing_Add.Text != "")
                                            {
                                                if (NUN_Carton_Add.Text.Length > 0 && NUN_Carton_Add.Text != "")
                                                {
                                                    label191.Text = "";
                                                    dataGridView1.ClearSelection();
                                                    LIB.insert("insert into [alssafa].[dbo].[BOOKS] values ('" + CodeBook_Add.Text + "','" + BookName_Add.Text + "','" + AuthorName_Add.Text + "'," + Cost_Add.Text + ",'" + Volumescode_Add.Text + "','" + Category_Add.Text + "','" + CodeSuppliers_Add.Text + "'," + NUN_Carton_Add.Text + "," + Packing_Add.Text + "," + Total_Add.Text + ");");
                                                    LIB.GridDisplay(dataGridView1, "BOOKS", "select * from BOOKS");

                                                    LIB.ComboDisplay(VolumesName_Add, "select إسم_المجلد from alssafa.dbo.Volumes ", "BOOKS", "إسم_المجلد");
                                                    VolumesName_Add.Text = "اختر المجلد";
                                                    Volumescode_Add.Text = "كود المجلد";

                                                    CodeBook_Add.Clear();
                                                    BookName_Add.Clear();
                                                    AuthorName_Add.Clear();
                                                    Cost_Add.Clear();
                                                    Category_Add.Refresh();
                                                    Packing_Add.Clear();
                                                    NUN_Carton_Add.Clear();
                                                    Total_Add.Clear();
                                                }
                                                else label191.Text = "أدخل عدد الكراتين";
                                            }
                                            else label191.Text = "أدخل تعبئة الكرتونة";

                                        }
                                        else label191.Text = "اختار أسم المورد";
                                    }
                                    else label191.Text = "اختار أسم المجلد";
                                }
                                else label191.Text = "أدخل تصنيف الكتاب";
                            }
                            else label191.Text = "أدخل سعر الكتاب";
                        }
                        else label191.Text = "أدخل اسم المؤلف";
                    }
                    else label191.Text = "أدخل اسم الكتاب";
                }
                else label191.Text = "أدخل كود الكتاب";


           
        }
        //=====================
        private void CodeBook_Add_TextChanged(object sender, EventArgs e)
        {
            LIB.ComboDisplay(VolumesName_Add, "select إسم_المجلد from alssafa.dbo.Volumes ", "BOOKS", "إسم_المجلد");
            VolumesName_Add.Text = "اختر المجلد";
            Volumescode_Add.Text = "كود المجلد";


        }
        //=====================
        private void VolumesName_Add_SelectedIndexChanged(object sender, EventArgs e)
        {
            LIB.ComboDisplayChoose(comboBox1, "Select * from Volumes where إسم_المجلد = " + "'" + VolumesName_Add.Text + "'", "Volumes", "كود_المجلد", Volumescode_Add);
        }
        //=====================
        private void button6_Click(object sender, EventArgs e)
        {
           CodeBook_Add.Clear();
           BookName_Add.Clear();
           AuthorName_Add.Clear();
           Cost_Add.Clear();
           Category_Add.ResetText();
           Volumescode_Add.Clear();
           CodeSuppliers_Add.Clear();
           Packing_Add.Clear();
           NUN_Carton_Add.Clear();
           VolumesName_Add.ResetText();
           SuppliersName_AddB.ResetText();
           Total_Add.Clear();
        }


        private void tabPage10_Enter(object sender, EventArgs e)
        {
            label191.Text = "";
            CodeBook_Add.Clear();
            BookName_Add.Clear();
            AuthorName_Add.Clear();
            Cost_Add.Clear();
            Category_Add.ResetText();
            Packing_Add.Clear();
            NUN_Carton_Add.Clear();
            Total_Add.Clear();
        }
        //=======================================الكتب==========================================
        //=======================================================================================
        //=======================================================================================

                                  //=========================================
                                  //=                                       =
                                  //=========================================

        //=======================================================================================
        //=======================================================================================
        //=======================================الموردين=======================================


        private void tabPage15_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(SuppliersName_Edit, "select إسم_المورد from alssafa.dbo.Suppliers ", "Suppliers", "إسم_المورد");
            SuppliersName_Edit.Text = "اختر المورد";
            CodeSuppliers_1_Edit.Text = "كود المورد";
            SuppliersAddress_Edit.Text = "";
            SuppliersPhone_Edit.Text = "";
            Suppliers_Email_Edit.Text = " ";
            SuppliersFAX_Edit.Text = "";
        }
        //===================
        private void tabPage14_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(SuppliersName_Delete, "select إسم_المورد from alssafa.dbo.Suppliers ", "Suppliers", "إسم_المورد");
            SuppliersName_Delete.Text = "اختر المورد";
            CodeSuppliers_1_Delete.Text = "كود المورد";
            label206.Text = "";
        }
        //===================
        private void OK3_Edit_Click(object sender, EventArgs e)
        {
            label199.Text = "";
            if (CodeSuppliers_1_Edit.Text != "كود المورد")
            {
                if (CodeSuppliers_1_Edit.Text.Length > 0)
                {
                    if (SuppliersAddress_Edit.Text.Length != 0)
                    {

                        if (SuppliersPhone_Edit.Text.Length != 0)
                        {
                            if (SuppliersPhone_Edit.Text.Length <= 11 && SuppliersPhone_Edit.Text.Length >= 7)
                            {
                                //if (Suppliers_Email_Edit.Text.Length != 0)
                                //{
                                //    if (SuppliersFAX_Edit.Text.Length !=0)
                                //    {
                                

                                dataGridView1.ClearSelection();
                                LIB.update("UPDATE Suppliers SET عنوان_المورد='" + SuppliersAddress_Edit.Text + "' WHERE  كود_المورد='" + CodeSuppliers_1_Edit.Text + "'");
                                LIB.update("UPDATE Suppliers SET  رقم_التلفون=" + SuppliersPhone_Edit.Text + " where  كود_المورد='" + CodeSuppliers_1_Edit.Text + "'");
                                LIB.update("UPDATE Suppliers SET  البريد_الإلكتروني='" + Suppliers_Email_Edit.Text + "' where كود_المورد='" + CodeSuppliers_1_Edit.Text + "'");
                                LIB.update("UPDATE Suppliers SET رقم_الفاكس='" + SuppliersFAX_Edit.Text + "' where  كود_المورد='" + CodeSuppliers_1_Edit.Text + "'");
                                LIB.GridDisplay(dataGridView1, "Suppliers", "select * from Suppliers");

                                

                                LIB.ComboDisplay(SuppliersName_Edit, "select إسم_المورد from alssafa.dbo.Suppliers ", "Suppliers", "إسم_المورد");
                                SuppliersName_Edit.Text = "اختر المورد";
                                CodeSuppliers_1_Edit.Clear();
                                SuppliersAddress_Edit.Clear();
                                SuppliersPhone_Edit.Clear();
                                Suppliers_Email_Edit.Clear();
                                SuppliersFAX_Edit.Clear();
                                label199.Text = "تمت عملية التعديل";


                                //    }
                                //    else
                                //        label199.Text = "قم بإدخال رقم الفاكس";

                                //}
                                //else
                                //    label199.Text = "قم بإدخال رقم الايميل";

                            }
                            else
                                label199.Text = "رقم الهاتف غير صحيح";

                        }
                        else
                            label199.Text = "قم بإدخال رقم التيلفون";
                    }
                    else
                        label199.Text = "قم بإدخال العنوان";
                }
                else
                    label199.Text = "اختر اسم المورد";
            }
            else
                label199.Text = "اختر اسم المورد";

        }
        //===================
        private void SuppliersName_Edit_SelectedIndexChanged(object sender, EventArgs e)
        {
            LIB.ComboDisplayChoose(comboBox16, "Select * from Suppliers where إسم_المورد = " + "'" + SuppliersName_Edit.Text + "'", "Suppliers", "كود_المورد", CodeSuppliers_1_Edit);
            LIB.ComboDisplayChoose(comboBox17, "Select * from Suppliers where إسم_المورد = " + "'" + SuppliersName_Edit.Text + "'", "Suppliers", "عنوان_المورد", SuppliersAddress_Edit);
            LIB.ComboDisplayChoose(comboBox18, "Select * from Suppliers where إسم_المورد = " + "'" + SuppliersName_Edit.Text + "'", "Suppliers", "رقم_التلفون", SuppliersPhone_Edit);
            LIB.ComboDisplayChoose(comboBox19, "Select * from Suppliers where إسم_المورد = " + "'" + SuppliersName_Edit.Text + "'", "Suppliers", "البريد_الإلكتروني", Suppliers_Email_Edit);
            LIB.ComboDisplayChoose(comboBox20, "Select * from Suppliers where إسم_المورد = " + "'" + SuppliersName_Edit.Text + "'", "Suppliers", "رقم_الفاكس", SuppliersFAX_Edit);



        }
        //===================
        private void tabPage15_Click(object sender, EventArgs e)
        {
            //LIB.ComboDisplay(SuppliersName_Edit, "select إسم_المورد from alssafa.dbo.Suppliers ", "Suppliers", "إسم_المورد");
            //SuppliersName_Edit.Text = "اختر المورد";
            //CodeSuppliers_1_Edit.Text = "كود المورد";
            //SuppliersAddress_Edit.Text = "";
            //SuppliersPhone_Edit.Text = "";
            //Suppliers_Email_Edit.Text = " ";
            //SuppliersFAX_Edit.Text = "";

        }
        //===================
        private void tabPage3_Click(object sender, EventArgs e)
        {
            //    LIB.ComboDisplay(VolumesName_Delete, "select إسم_المجلد  from alssafa.dbo.Volumes ", "Volumes", "إسم_المجلد  ");
            //    VolumesName_Delete.Text = "اختر المجلد";
            //    VolumesCode_Delete.Text = "كود المجلد";
        }
        //===================
        private void OK3_Add_Click(object sender, EventArgs e)
        {
            if (CodeSuppliers_1_Add.Text.Length != 0)
            {
                if (SuppliersName_Add.Text.Length != 0)
                {
                    if (SuppliersAddress_Add.Text.Length != 0)
                    {
                        if (SuppliersPhone_Add.Text.Length != 0)
                        {
                            if (SuppliersPhone_Add.Text.Length <= 11 && SuppliersPhone_Add.Text.Length >= 7)
                            {

                                         label203.Text = "";
                                        dataGridView1.ClearSelection();
                                        LIB.insert("insert into [alssafa].[dbo].[Suppliers] values ('" + CodeSuppliers_1_Add.Text + "','" + SuppliersName_Add.Text + "','" + SuppliersAddress_Add.Text + "'," + SuppliersPhone_Add.Text + ",'" + SuppliersFAX_Add.Text + "','" + SuppliersEMAIL_Add.Text + "');");
                                        LIB.GridDisplay(dataGridView1, "Suppliers", "select * from Suppliers");
                                        CodeSuppliers_1_Add.Clear();
                                        SuppliersName_Add.Clear();
                                        SuppliersAddress_Add.Clear();
                                        SuppliersPhone_Add.Clear();
                                        SuppliersFAX_Add.Clear();
                                        SuppliersEMAIL_Add.Clear();

                              
                            }
                            else
                                label203.Text = "رقم الهاتف غير صحيح";
                        }
                        else
                            label203.Text = "قم بإدخال رقم التيلفون";
                    }
                    else
                        label203.Text = "قم بإدخال العنوان";
                }
                else
                    label203.Text = "قم بإدخال أسم المورد";

            }
            else
                label203.Text = "قم بإدخال كود المورد";




        }
        //===================
        private void SuppliersName_Delete_SelectedIndexChanged(object sender, EventArgs e)
        {
            LIB.ComboDisplayChoose(comboBox2, "Select * from Suppliers where إسم_المورد = " + "'" + SuppliersName_Delete.Text + "'", "Suppliers", "كود_المورد", CodeSuppliers_1_Delete);

        }
        //===================
        private void tabPage14_Click(object sender, EventArgs e)
        {
            //LIB.ComboDisplay(SuppliersName_Delete, "select إسم_المورد from alssafa.dbo.Suppliers ", "Suppliers", "إسم_المورد");
            //SuppliersName_Delete.Text = "اختر المورد";
            //CodeSuppliers_1_Delete.Text = "كود المورد";
        }
        //===================
        private void OK3_Delete_Click(object sender, EventArgs e)
      
        {
            if (CodeSuppliers_1_Delete.Text != "كود المورد")
            {
                if (CodeSuppliers_1_Delete.Text.Length > 0)
                {
                    dataGridView1.ClearSelection();
                    LIB.delete("DELETE from Suppliers  where كود_المورد='" + CodeSuppliers_1_Delete.Text + "'");
                    LIB.GridDisplay(dataGridView1, "Suppliers", "select * from Suppliers");
                    //MessageBox.Show("تمت عملية الحذف");
                    LIB.ComboDisplay(SuppliersName_Delete, "select إسم_المورد from alssafa.dbo.Suppliers ", "Suppliers", "إسم_المورد");
                    SuppliersName_Delete.Text = "اختر المورد";
                    //CodeSuppliers_1_Delete.Text = "كود المورد";
                    CodeSuppliers_1_Delete.Clear();
                    label206.Text = "تمت عملية الحذف";
 
                }
                else
                    label206.Text = "اختر اسم المورد الذي تريد حذفه";

            }
            else
                label206.Text = "اختر اسم المورد الذي تريد حذفه";

            
            
            

          
        }
        //===================
        private void tabPage13_Click(object sender, EventArgs e)
        {

        }
        //===================
        private void tabControl4_Click(object sender, EventArgs e)
        {
            SuppliersName_Delete.Text = "اختر المورد";
            SuppliersName_Edit.Text = "اختر المورد";
        }

        //=======================================الموردين=======================================
        //=======================================================================================
        //=======================================================================================

                                    //=========================================
                                    //=                                       =
                                    //=========================================


        //=======================================================================================
        //=======================================================================================
        //=======================================المجلدين=======================================

        private void tabPage17_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(VolumesName_Delete, "select إسم_المجلد from alssafa.dbo.Volumes ", "Volumes", "إسم_المجلد");
            VolumesName_Delete.Text = "اختر المجلد";
            VolumesCode_Delete.Text = "كود المجلد";
        }
        //===================

        private void tabControl7_Click(object sender, EventArgs e)
        {
            VolumesName_Delete.Text = "اختر المجلد";
            VolumesName_Edit.Text = "اختر المجلد";
        }
        //===================

        private void tabPage18_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(VolumesName_Edit, "select إسم_المجلد from alssafa.dbo.Volumes ", "Volumes", "إسم_المجلد");
            VolumesName_Edit.Text = "اختر المجلد";
            VolumesCode_Edit.Text = "كود المجلد";
            VolumesAddress_Edit.Text = "";
            VolumesPhone_Edit.Text = "";
            VolumesEMAIL_Edit.Text = " ";
            VolumesFAX_Edit.Text = "";
        }
        //===================
        private void VolumesName_Edit_SelectedIndexChanged(object sender, EventArgs e)
        {
            LIB.ComboDisplayChoose(comboBox11, "Select * from Volumes where إسم_المجلد = " + "'" + VolumesName_Edit.Text + "'", "Volumes", "كود_المجلد", VolumesCode_Edit);
            LIB.ComboDisplayChoose(comboBox12, "Select * from Volumes where إسم_المجلد = " + "'" + VolumesName_Edit.Text + "'", "Volumes", "عنوان_المجلد", VolumesAddress_Edit);
            LIB.ComboDisplayChoose(comboBox13, "Select * from Volumes where إسم_المجلد = " + "'" + VolumesName_Edit.Text + "'", "Volumes", "رقم_التلفون", VolumesPhone_Edit);
            LIB.ComboDisplayChoose(comboBox14, "Select * from Volumes where إسم_المجلد = " + "'" + VolumesName_Edit.Text + "'", "Volumes", "رقم_الفاكس", VolumesFAX_Edit);
            LIB.ComboDisplayChoose(comboBox14, "Select * from Volumes where إسم_المجلد = " + "'" + VolumesName_Edit.Text + "'", "Volumes", "البريد_الإلكتروني", VolumesEMAIL_Edit);
        }
        //===================

        private void tabPage18_Click(object sender, EventArgs e)
        {
            //LIB.ComboDisplay(VolumesName_Edit, "select إسم_المجلد from alssafa.dbo.Volumes ", "Volumes", "إسم_المجلد");
            //VolumesName_Edit.Text = "اختر المجلد";
            //VolumesCode_Edit.Text = "كود المجلد";
            //VolumesAddress_Edit.Text = "";
            //VolumesPhone_Edit.Text = "";
            //VolumesEMAIL_Edit.Text = " ";
            //VolumesFAX_Edit.Text = "";

        }
        //===================

        private void OK4_Edit_Click(object sender, EventArgs e)
        {
            label200.Text = "";
            if (VolumesCode_Edit.Text != "كود المجلد")
            {
                if (VolumesCode_Edit.Text.Length > 0)
                {
                    if (VolumesAddress_Edit.Text.Length != 0)
                    {
                        if (VolumesPhone_Edit.Text.Length != 0)
                        {
                            if (VolumesPhone_Edit.Text.Length <= 11 && VolumesPhone_Edit.Text.Length >= 7)
                            {

                                dataGridView1.ClearSelection();
                                LIB.update("UPDATE Volumes SET عنوان_المجلد='" + VolumesAddress_Edit.Text + "' WHERE  كود_المجلد='" + VolumesCode_Edit.Text + "'");
                                LIB.update("UPDATE Volumes SET  رقم_التلفون=" + VolumesPhone_Edit.Text + " where  كود_المجلد='" + VolumesCode_Edit.Text + "'");
                                LIB.update("UPDATE Volumes SET رقم_الفاكس='" + VolumesFAX_Edit.Text + "' where  كود_المجلد='" + VolumesCode_Edit.Text + "'");
                                LIB.update("UPDATE Volumes SET  البريد_الإلكتروني='" + VolumesEMAIL_Edit.Text + "' where  كود_المجلد='" + VolumesCode_Edit.Text + "'");
                                LIB.GridDisplay(dataGridView1, "Volumes", "select * from Volumes");
                                

                                LIB.ComboDisplay(VolumesName_Edit, "select إسم_المجلد from alssafa.dbo.Volumes ", "Volumes", "إسم_المجلد");
                                VolumesName_Edit.Text = "اختر المجلد";
                                VolumesCode_Edit.Clear();
                                VolumesAddress_Edit.Clear();
                                VolumesPhone_Edit.Clear();
                                VolumesEMAIL_Edit.Clear();
                                VolumesFAX_Edit.Clear();
                                label200.Text = "تمت عملية التعديل";
                            }
                            else
                                label200.Text = "رقم الهاتف غير صحيح";
                        }
                        else
                            label200.Text = "قم بإدخال رقم الهاتف";
                    }
                    else
                        label200.Text = "قم بإدخال العنوان";
                }
                else
                    label200.Text = "اختر اسم المجلد";
            }
            else
                label200.Text = "اختر اسم المجلد";
        }
        //===================



        private void VolumesCode_Edit_TextChanged(object sender, EventArgs e)
        {
            label200.Text = "";
        }
        //===================
        private void OK4_Add_Click(object sender, EventArgs e)
        {
            if (CodeVolumes_Add.Text.Length != 0)
            {
                if (VolumesNmae_Add.Text.Length != 0)
                {
                    if (VolumesAddress_Add.Text.Length != 0)
                    {
                        if (VolumesPhone_Add.Text.Length != 0)
                        {
                            if (VolumesPhone_Add.Text.Length <= 11 && VolumesPhone_Add.Text.Length >= 7)
                            {

                                //if (VolumesFAX_Add.Text.Length != 0)
                                //{
                                //    if (VolumesEMAIL_Add.Text.Length != 0)
                                //    {

                                        label202.Text = "";
                                        dataGridView1.ClearSelection();
                                        LIB.insert("insert into [alssafa].[dbo].[Volumes] values ('" + CodeVolumes_Add.Text + "','" + VolumesNmae_Add.Text + "','" + VolumesAddress_Add.Text + "'," + VolumesPhone_Add.Text + ",'" + VolumesFAX_Add.Text + "','" + VolumesEMAIL_Add.Text + "');");
                                        LIB.GridDisplay(dataGridView1, "Volumes", "select * from Volumes");

                                        CodeVolumes_Add.Clear();
                                        VolumesNmae_Add.Clear();
                                        VolumesAddress_Add.Clear();
                                        VolumesPhone_Add.Clear();
                                        VolumesFAX_Add.Clear();
                                        VolumesEMAIL_Add.Clear();
                                //    }
                                //    else
                                //        label202.Text = "قم بإدخال الايميل";
                                //}
                                //else label202.Text = "قم بإدخال رقم الفاكس";
                            }
                            else
                                label202.Text = "رقم الهاتف غير صحيح";
                        }
                        else
                            label202.Text = "قم بإدخال رقم الهاتف";
                    }
                    else
                        label202.Text = "قم بإدخال العنوان";
                }
                else
                    label202.Text = "قم بإدخال أسم المجلد";

            }
            else
                label202.Text = "قم بإدخال كود المجلدد";


        }
        //===================

        private void VolumesName_Delete_SelectedIndexChanged(object sender, EventArgs e)
        {

            LIB.ComboDisplayChoose(comboBox9, "Select * from Volumes where إسم_المجلد = " + "'" + VolumesName_Delete.Text + "'", "Volumes", "كود_المجلد", VolumesCode_Delete);

        }
        //===================


        private void button4_Click(object sender, EventArgs e)
        {
            if (VolumesCode_Delete.Text != "كود المجلد")
            {
                if (VolumesCode_Delete.Text.Length > 0)
                {

                    dataGridView1.ClearSelection();
                    LIB.delete("DELETE from Volumes  where كود_المجلد='" + VolumesCode_Delete.Text + "'");
                    LIB.GridDisplay(dataGridView1, "Volumes", "select * from Volumes");
                    //MessageBox.Show("تمت عملية الحذف");
                    LIB.ComboDisplay(VolumesName_Delete, "select إسم_المجلد from alssafa.dbo.Volumes ", "Volumes", "إسم_المجلد");
                    VolumesName_Delete.Text = "اختر المجلد";
                    //VolumesCode_Delete.Text = "كود المجلد";
                    VolumesCode_Delete.Clear();
                    label207.Text = "تمت عملية الحذف";
 
                }
                else
                    label207.Text = "اختر اسم المجلد الذي نريد حذفه";
            }
            else
                label207.Text = "اختر اسم المجلد الذي نريد حذفه";

            
            
            
            

        

        }
        //===================
        private void tabPage17_Click(object sender, EventArgs e)
        {
            //LIB.ComboDisplay(VolumesName_Delete, "select إسم_المجلد from alssafa.dbo.Volumes ", "Volumes", "إسم_المجلد");
            //VolumesName_Delete.Text = "اختر المجلد";
            //VolumesCode_Delete.Text = "كود المجلد";

        }
        //===================


        //=======================================المجلدين=======================================
        //=======================================================================================
        //=======================================================================================


                                      //=========================================
                                      //=                                       =
                                      //=========================================



        //=======================================================================================
        //=======================================================================================
        //=======================================إذن الإضافة=====================================
        private void SO_ADDED_SupplayerCode_Add_TextChanged(object sender, EventArgs e)
        {

        }
        //===================
        private void SO_ADDED_Total_Add_TextChanged(object sender, EventArgs e)
        {

        }
        //===================
        private void SO_ADDED_NUM_Delete_TextChanged(object sender, EventArgs e)
        {
            SO_ADDED_Total_Delete.Clear();
            SO_ADDED_Packing_Delete.Clear();
            SO_ADDED_Carton_Delete.Clear();
            SO_ADDED_SupplayerCode_Delete.Clear();
            SO_ADDED_BookCode_Delete.Clear();
            SO_ADDED_date_Delete.Clear();
            label148.Text = "";
        }
        //===================
        private void button5_Click(object sender, EventArgs e)
        {
            
            //if (dataGridView1.RowCount.Equals(1))
            //{
            //    MessageBox.Show("تأكد من رقم الإذن المدخل");
            //}
            //else
            //{
            //    LIB.delete("DELETE from SO_ADDED  where رقم_إذن_الإضافة=" + SO_ADDED_NUM_Delete.Text + "");
            //    LIB.GridDisplay(dataGridView1, "SO_ADDED", "select * from alssafa.dbo.SO_ADDED");
            //}


            if (SO_ADDED_date_Delete.Text.Length > 0)
            {
                LIB.ComboDisplay(comboBox47, "select * from alssafa.dbo.BOOKS where كود_الكتاب = '" + SO_ADDED_BookCode_Delete.Text + "'", "BOOKS", "اجمالي_النسخ");
                if (int.Parse(comboBox47.Text) >= int.Parse(SO_ADDED_Total_Delete.Text))
                {
                    totalOFBOOK02.Text = Convert.ToString((int.Parse(comboBox47.Text)) - (int.Parse(SO_ADDED_Total_Delete.Text)));
                    LIB.update("UPDATE BOOKS SET اجمالي_النسخ=" + totalOFBOOK02.Text + " where كود_الكتاب='" + SO_ADDED_BookCode_Delete.Text + "'");


                    LIB.delete("DELETE from SO_ADDED  where رقم_إذن_الإضافة=" + SO_ADDED_NUM_Delete.Text + "");
                    LIB.GridDisplay(dataGridView1, "SO_ADDED", "select * from alssafa.dbo.SO_ADDED");
                    //label148.Text = "تمت عملية الحذف";
                    SO_ADDED_NUM_Delete.Clear();
                    label148.Text = "تمت عملية الحذف";
                                
                }
                else
                    label148.Text = "الكمية غير متوفرة";
                            




            }
            else
                label148.Text = "تأكد من رقم الإذن المدخل";


        }
        //===================
        private void tabPage5_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(SO_ADDED_BookName_Add, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            SO_ADDED_BookName_Add.Text = "اختر الكتاب";
            SO_ADDED_BookCode_Add.Text = "كود الكتاب";
        }
        //===================
        private void SO_ADDED_BookName_Add_SelectedIndexChanged(object sender, EventArgs e)
        {

            LIB.ComboDisplayChoose(BookNameCheck, "Select * from BOOKS where إسم_الكتاب = " + "'" + SO_ADDED_BookName_Add.Text + "'", "BOOKS", "كود_الكتاب", SO_ADDED_BookCode_Add);

        }
        //===================
        private void tabPage5_Click(object sender, EventArgs e)
        {

        }
        //===================
        private void SO_ADDED_NUM_Add_TextChanged(object sender, EventArgs e)
        {
            //SqlCommand Show_BookName_command = new SqlCommand();
            //Show_BookName_command.CommandType = CommandType.Text;
            //Show_BookName_command.CommandText = "select إسم_الكتاب from alssafa.dbo.BOOKS ";
            //Show_BookName_command.Connection = Connection_Main;
            //SqlDataAdapter Show_BookName_adapt = new SqlDataAdapter();
            //DataSet Show_BookName_ds = new DataSet();
            //Show_BookName_adapt.SelectCommand = Show_BookName_command;
            //Show_BookName_ds.Clear();

            //Show_BookName_adapt.Fill(Show_BookName_ds, "BOOKS");
            //SO_ADDED_BookName_Add.DataSource = Show_BookName_ds.Tables["BOOKS"];

            //SO_ADDED_BookName_Add.DisplayMember = "إسم_الكتاب";
            //SO_ADDED_BookName_Add.Text = "اختر الكتاب";
            //SO_ADDED_BookCode_Add.Text = "كود الكتاب";
            //Connection_Main.Close();
            ////=========================================
            //BookNameCheck.Text = "اختار الاسم";
            //====================================================================================
            //====================================================================================
            //====================================================================================

        }//====
        //===================
        private void SO_ADDED_BookCode_Add_TextChanged(object sender, EventArgs e)
        {
            //SqlCommand Show_SupplierName_command = new SqlCommand();
            //Show_SupplierName_command.CommandType = CommandType.Text;
            //Show_SupplierName_command.CommandText = "select إسم_المورد from alssafa.dbo.Suppliers ";
            //Show_SupplierName_command.Connection = Connection_Main;
            //SqlDataAdapter Show_SupplierName_adapt = new SqlDataAdapter();
            //DataSet Show_SupplierName_ds = new DataSet();
            //Show_SupplierName_adapt.SelectCommand = Show_SupplierName_command;
            //Show_SupplierName_ds.Clear();

            //Show_SupplierName_adapt.Fill(Show_SupplierName_ds, "Suppliers");
            //SO_ADDED_SupplayerName_Add.DataSource = Show_SupplierName_ds.Tables["Suppliers"];

            //SO_ADDED_SupplayerName_Add.DisplayMember = "إسم_المورد";
            //SO_ADDED_SupplayerName_Add.Text = "اختر المورد";
            //SO_ADDED_SupplayerCode_Add.Text = "كود المورد";
            //Connection_Main.Close();
            ////=========================================
            //SupplierNameCheck.Text = "اختار الاسم";
            //====================================================================================
            //====================================================================================
            //====================================================================================
            LIB.ComboDisplay(SO_ADDED_SupplayerName_Add, "select إسم_المورد from alssafa.dbo.Suppliers ", "Suppliers", "إسم_المورد");
            SO_ADDED_SupplayerName_Add.Text = "اختر المورد";
            SO_ADDED_SupplayerCode_Add.Text = "كود المورد";

        }
        //===================
        private void SO_ADDED_SupplayerName_Add_SelectedIndexChanged(object sender, EventArgs e)
        {

            LIB.ComboDisplayChoose(SupplierNameCheck, "Select * from Suppliers where إسم_المورد = " + "'" + SO_ADDED_SupplayerName_Add.Text + "'", "Suppliers", "كود_المورد", SO_ADDED_SupplayerCode_Add);

        }
        //===================
        private void SO_ADDED_Packing_Add_TextChanged(object sender, EventArgs e)
        {
            SO_ADDED_Carton_Add.Enabled = true;
            try
            {
                if (SO_ADDED_Carton_Add.Text == "" || SO_ADDED_Packing_Add.Text == "")
                {
                    a = 0;
                    b = 0;
                    SO_ADDED_Total_Add.Text = Convert.ToString(a * b);
                }
                else
                {
                    a = int.Parse(SO_ADDED_Packing_Add.Text);
                    b = int.Parse(SO_ADDED_Carton_Add.Text);
                    SO_ADDED_Total_Add.Text = Convert.ToString(a * b);
                }
            }
            catch (System.FormatException E)
            {
                MessageBox.Show("الرقم المدخل غير صحيح");
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("لا يمكن إدخال هذا الرقم");
            }
        }
        //===================
        private void SO_ADDED_Carton_Add_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (SO_ADDED_Carton_Add.Text == "" || SO_ADDED_Packing_Add.Text == "")
                {
                    a = 0;
                    b = 0;
                    SO_ADDED_Total_Add.Text = Convert.ToString(a * b);
                }
                else
                {
                    a = int.Parse(SO_ADDED_Packing_Add.Text);
                    b = int.Parse(SO_ADDED_Carton_Add.Text);
                    SO_ADDED_Total_Add.Text = Convert.ToString(a * b);
                }
            }
            catch (System.FormatException E)
            {
                MessageBox.Show("الرقم المدخل غير صحيح");
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("لا يمكن إدخال هذا الرقم");
            }
        }
        //===================
        private void OK5_Add_Click(object sender, EventArgs e)
        {


            if (SO_ADDED_BookCode_Add.Text.Length > 0 && SO_ADDED_BookCode_Add.Text != "كود الكتاب")
            {
                if (SO_ADDED_SupplayerCode_Add.Text.Length > 0 && SO_ADDED_SupplayerCode_Add.Text != "كود المورد")
                {
                    if (SO_ADDED_Packing_Add.Text.Length > 0 && SO_ADDED_Packing_Add.Text != "")
                    {
                        if (SO_ADDED_Carton_Add.Text.Length > 0 && SO_ADDED_Carton_Add.Text != "")
                        {
                            label205.Text = "";
                            dataGridView1.ClearSelection();
                            LIB.insert("insert into [alssafa].[dbo].[SO_ADDED] values ('" + SO_ADDED_date_Add.Text + "','" + SO_ADDED_BookCode_Add.Text + "','" + SO_ADDED_SupplayerCode_Add.Text + "'," + SO_ADDED_Carton_Add.Text + "," + SO_ADDED_Packing_Add.Text + "," + SO_ADDED_Total_Add.Text + ");");
                            LIB.GridDisplay(dataGridView1, "SO_ADDED", "select * from SO_ADDED");
                            LIB.ComboDisplay(comboBox46, "select * from alssafa.dbo.BOOKS where كود_الكتاب = '" + SO_ADDED_BookCode_Add.Text + "'", "BOOKS", "اجمالي_النسخ");
                            totalOFBOOK01.Text = Convert.ToString((int.Parse(comboBox46.Text)) + (int.Parse(SO_ADDED_Total_Add.Text)));
                            LIB.update("UPDATE BOOKS SET اجمالي_النسخ=" + totalOFBOOK01.Text + " where كود_الكتاب='" + SO_ADDED_BookCode_Add.Text + "'");

                            LIB.ComboDisplay(SO_ADDED_BookName_Add, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
                            SO_ADDED_BookName_Add.Text = "اختر الكتاب";
                            SO_ADDED_BookCode_Add.Text = "كود الكتاب";
                            SO_ADDED_Packing_Add.Clear();
                            SO_ADDED_Carton_Add.Clear();
                            SO_ADDED_Total_Add.Clear();
 
                        }
                        else
                            label205.Text = "أدخل عدد الكراتين";
                    }
                    else
                        label205.Text = "أدخل تعبئة الكرتونة";
                }
                else
                    label205.Text = "اختر اسم المورد";
          
                
            }
            else
                label205.Text = "اختر اسم الكتاب";
        }
        //===================
        private void delet_SO_ADDED_Enter_Click(object sender, EventArgs e)
        {   

            //SO_ADDED_Total_Delete.Clear();
            //SO_ADDED_Packing_Delete.Clear();
            //SO_ADDED_Carton_Delete.Clear();
            //SO_ADDED_SupplayerCode_Delete.Clear();
            //SO_ADDED_BookCode_Delete.Clear();
            //SO_ADDED_date_Delete.Clear();
            //label148.Text = "";
            ////SqlCommand Show_SO_ADDED_command = new SqlCommand();
            ////Show_SO_ADDED_command.CommandType = CommandType.Text;
            ////Show_SO_ADDED_command.CommandText = "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ";
            ////Show_SO_ADDED_command.Connection = Connection_Main;
            ////SqlDataAdapter Show_SO_ADDED_adapt = new SqlDataAdapter();
            ////DataSet Show_SO_ADDED_ds = new DataSet();
            ////Show_SO_ADDED_adapt.SelectCommand = Show_SO_ADDED_command;
            ////Show_SO_ADDED_ds.Clear();
            //LIB.GridDisplay(dataGridView1, "SO_ADDED", "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ");
            ////Show_SO_ADDED_adapt.Fill(Show_SO_ADDED_ds, "SO_ADDED");
            ////dataGridView1.DataSource = Show_SO_ADDED_ds.Tables["SO_ADDED"];
            ////dataGridView1.DataMember = "SO_ADDED";
            //if (dataGridView1.RowCount.Equals(1))
            //{
            //    label148.Text = "لا يوجد اذن اضافة بهذا الرقم";
            //}
            //else
            //{
            //    LIB.ComboDisplayChoose(comboBox30, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "التاريخ", SO_ADDED_date_Delete);
            //    LIB.ComboDisplayChoose(comboBox31, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "كود_الكتاب", SO_ADDED_BookCode_Delete);
            //    LIB.ComboDisplayChoose(comboBox32, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "كود_المورد", SO_ADDED_SupplayerCode_Delete);
            //    LIB.ComboDisplayChoose(comboBox33, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "عدد_الكراتين", SO_ADDED_Carton_Delete);
            //    LIB.ComboDisplayChoose(comboBox34, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "تعبئة_الكراتين", SO_ADDED_Packing_Delete);
            //    LIB.ComboDisplayChoose(comboBox35, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "إجمالي_النسخ", SO_ADDED_Total_Delete);
            //}
            //            ////SO_ADDED_date_Delete.Text = "select التاريخ from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ";
            ////Connection_Main.Close();
            ////=========================================

            if (SO_ADDED_NUM_Delete.Text.Length > 0)
            {
                label148.Text = "";
                int number = 0;
                if (int.TryParse(SO_ADDED_NUM_Delete.Text, out number))
                {
                    //LIB.ComboDisplay(comboBox42, "select * from alssafa.dbo.So_Exchangewhere رقم_إذن_الصرف = " + So_Exchange_NUM_Delete.Text + " ", "So_Exchange", "رقم_إذن_الصرف");
                    LIB.ComboDisplay(comboBox43, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة  = " + SO_ADDED_NUM_Delete.Text + "", "SO_ADDED", "رقم_إذن_الإضافة");
                    if (comboBox43.Text.Length > 0)
                    {

                        LIB.ComboDisplayChoose(comboBox30, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "التاريخ", SO_ADDED_date_Delete);
                        LIB.ComboDisplayChoose(comboBox31, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "كود_الكتاب", SO_ADDED_BookCode_Delete);
                        LIB.ComboDisplayChoose(comboBox32, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "كود_المورد", SO_ADDED_SupplayerCode_Delete);
                        LIB.ComboDisplayChoose(comboBox33, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "عدد_الكراتين", SO_ADDED_Carton_Delete);
                        LIB.ComboDisplayChoose(comboBox34, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "تعبئة_الكراتين", SO_ADDED_Packing_Delete);
                        LIB.ComboDisplayChoose(comboBox35, "select * from alssafa.dbo.SO_ADDED where رقم_إذن_الإضافة = '" + SO_ADDED_NUM_Delete.Text + "' ", "SO_ADDED", "إجمالي_النسخ", SO_ADDED_Total_Delete);
                    }
                    else
                        label148.Text = "رقم الإذن المدخل غير موجود";
                }
                else
                    label148.Text = "أدخل رقم الإذن صحيحا";
            }
            else
                label148.Text = "أدخل رقم الإذن";
        


        }
        //===================
        private void tabPage19_Enter(object sender, EventArgs e)
        {
            //SO_ADDED_NUM_Add.Clear();
            LIB.ComboDisplay(SO_ADDED_BookName_Add, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            SO_ADDED_BookName_Add.Text = "اختر الكتاب";
            SO_ADDED_BookCode_Add.Text = "كود الكتاب";
            SO_ADDED_Packing_Add.Clear();
            SO_ADDED_Carton_Add.Clear();
            SO_ADDED_Total_Add.Clear();
        }
        private void tabControl5_Click(object sender, EventArgs e)
        {
            SO_ADDED_BookName_Add.Text = "اختر الكتاب";
        }

        //===================
        //=======================================إذن الإضافة=====================================
        //=======================================================================================
        //=======================================================================================

        private void So_Exchange_Paking_Add_TextChanged(object sender, EventArgs e)
        {
            So_Exchange_Carton_Add.Enabled = true;
            try
            {
                if (So_Exchange_Paking_Add.Text == "" || So_Exchange_Carton_Add.Text == "")
                {
                    a = 0;
                    b = 0;
                    So_Exchange_Total_Add.Text = Convert.ToString(a * b);
                }
                else
                {
                    a = int.Parse(So_Exchange_Paking_Add.Text);
                    b = int.Parse(So_Exchange_Carton_Add.Text);
                    So_Exchange_Total_Add.Text = Convert.ToString(a * b);
                }
            }
            catch (System.FormatException E)
            {
                MessageBox.Show("الرقم المدخل غير صحيح");
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("لا يمكن إدخال هذا الرقم");
            }
        }

        private void So_Exchange_Carton_Add_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (So_Exchange_Carton_Add.Text == "" || So_Exchange_Paking_Add.Text == "")
                {
                    a = 0;
                    b = 0;
                    So_Exchange_Total_Add.Text = Convert.ToString(a * b);
                }
                else
                {
                    a = int.Parse(So_Exchange_Paking_Add.Text);
                    b = int.Parse(So_Exchange_Carton_Add.Text);
                    So_Exchange_Total_Add.Text = Convert.ToString(a * b);
                }
            }
            catch (System.FormatException E)
            {
                MessageBox.Show("الرقم المدخل غير صحيح");
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("لا يمكن إدخال هذا الرقم");
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            //So_Exchange_Date_Delete.Clear();
            //So_Exchange_BookCode_Delete.Clear();
            //So_Exchange_NameOf_Delete.Clear();
            //So_Exchange_Paking_Delete.Clear();
            //So_Exchange_Carton_Delete.Clear();
            //So_Exchange_Total_Delete.Clear();
            //label190.Text = "";
            //LIB.GridDisplay(dataGridView1, "So_Exchange", "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ");
            
            
            //if (dataGridView1.RowCount.Equals(1))
            //{
            //    label190.Text = "لا يوجد اذن اضافة بهذا الرقم";
            //}
            //else
            //{
            //    LIB.ComboDisplayChoose(comboBox36, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "التاريخ", So_Exchange_Date_Delete);
            //    LIB.ComboDisplayChoose(comboBox37, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "كود_الكتاب", So_Exchange_BookCode_Delete);
            //    LIB.ComboDisplayChoose(comboBox38, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "إسم_الجهة_المنصرف_إليها", So_Exchange_NameOf_Delete);
            //    LIB.ComboDisplayChoose(comboBox39, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "عدد_الكراتين", So_Exchange_Carton_Delete);
            //    LIB.ComboDisplayChoose(comboBox40, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "تعبئة_الكرتونة", So_Exchange_Paking_Delete);
            //    LIB.ComboDisplayChoose(comboBox41, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "إجمالي_النسخ", So_Exchange_Total_Delete);
            //}

            //So_Exchange_Date_Delete.Clear();
            //So_Exchange_BookCode_Delete.Clear();
            //So_Exchange_NameOf_Delete.Clear();
            //So_Exchange_Paking_Delete.Clear();
            //So_Exchange_Carton_Delete.Clear();
            //So_Exchange_Total_Delete.Clear();
            label190.Text = "";
            if (So_Exchange_NUM_Delete.Text.Length > 0)
            {
                int number = 0;
                if (int.TryParse(So_Exchange_NUM_Delete.Text, out number))
                {
                    //LIB.ComboDisplay(comboBox42, "select * from alssafa.dbo.So_Exchangewhere رقم_إذن_الصرف = " + So_Exchange_NUM_Delete.Text + " ", "So_Exchange", "رقم_إذن_الصرف");
                    LIB.ComboDisplay(comboBox42, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف  = " + So_Exchange_NUM_Delete.Text + "", "So_Exchange", "رقم_إذن_الصرف");
                    if (comboBox42.Text.Length > 0)
                    {

                        LIB.ComboDisplayChoose(comboBox36, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "التاريخ", So_Exchange_Date_Delete);
                        LIB.ComboDisplayChoose(comboBox37, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "كود_الكتاب", So_Exchange_BookCode_Delete);
                        LIB.ComboDisplayChoose(comboBox38, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "إسم_الجهة_المنصرف_إليها", So_Exchange_NameOf_Delete);
                        LIB.ComboDisplayChoose(comboBox39, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "عدد_الكراتين", So_Exchange_Carton_Delete);
                        LIB.ComboDisplayChoose(comboBox40, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "تعبئة_الكرتونة", So_Exchange_Paking_Delete);
                        LIB.ComboDisplayChoose(comboBox41, "select * from alssafa.dbo.So_Exchange where رقم_إذن_الصرف = '" + So_Exchange_NUM_Delete.Text + "' ", "So_Exchange", "إجمالي_النسخ", So_Exchange_Total_Delete);
                    }
                    else
                        label190.Text = "رقم الإذن المدخل غير موجود";
                }
                else
                    label190.Text = "أدخل رقم الإذن صحيحا";
            }
            else
                label190.Text = "أدخل رقم الإذن";
        
        
        }

        private void OK6_Delete_Click(object sender, EventArgs e)
        {
            //if (dataGridView1.RowCount.Equals(1))
            //{
            //    MessageBox.Show("تأكد من رقم الإذن المدخل");
            //}
            //else
            //{
            //    LIB.delete("DELETE from So_Exchange  where رقم_إذن_الصرف=" + So_Exchange_NUM_Delete.Text + "");
            //    LIB.GridDisplay(dataGridView1, "So_Exchange", "select * from alssafa.dbo.So_Exchange");
            //}

            if (So_Exchange_Date_Delete.Text.Length > 0)
            {

                LIB.ComboDisplay(comboBox45, "select * from alssafa.dbo.BOOKS where كود_الكتاب = '" + So_Exchange_BookCode_Delete.Text + "'", "BOOKS", "اجمالي_النسخ");
                totalOfBOOK0.Text = Convert.ToString((int.Parse(comboBox45.Text)) + (int.Parse(So_Exchange_Total_Delete.Text)));
                LIB.update("UPDATE BOOKS SET اجمالي_النسخ=" + totalOfBOOK0.Text + " where كود_الكتاب='" + So_Exchange_BookCode_Delete.Text + "'");
                            
                LIB.delete("DELETE from So_Exchange  where رقم_إذن_الصرف=" + So_Exchange_NUM_Delete.Text + "");
                LIB.GridDisplay(dataGridView1, "So_Exchange", "select * from alssafa.dbo.So_Exchange");
                label190.Text = "تمت عملية الحذف";
                //=============================================
                So_Exchange_NUM_Delete.Clear();
                So_Exchange_Date_Delete.Clear();
                So_Exchange_BookCode_Delete.Clear();
                So_Exchange_NameOf_Delete.Clear();
                So_Exchange_Paking_Delete.Clear();
                So_Exchange_Carton_Delete.Clear();
                So_Exchange_Total_Delete.Clear();
            }
            else
                label190.Text = "تأكد من رقم الإذن المدخل";

        }

        private void So_Exchange_NUM_Add_TextChanged(object sender, EventArgs e)//===========
        {
            //So_Exchange_NameOf_Add.Text.Length > 0
            //So_Exchange_BookCode_Add.Text.Length > 0 && So_Exchange_BookCode_Add.Text != "كود الكتاب"
        }

        private void OK6_Add_Click(object sender, EventArgs e)
        {
            if (So_Exchange_BookCode_Add.Text.Length > 0 && So_Exchange_BookCode_Add.Text != "كود الكتاب")
            {
                if (So_Exchange_NameOf_Add.Text.Length > 0)
                {
                    if (So_Exchange_Paking_Add.Text.Length > 0 && So_Exchange_Paking_Add.Text != "")
                    {
                        if (So_Exchange_Carton_Add.Text.Length > 0 && So_Exchange_Carton_Add.Text != "")
                        {
                            LIB.ComboDisplay(comboBox44, "select * from alssafa.dbo.BOOKS where كود_الكتاب = '" + So_Exchange_BookCode_Add.Text + "'", "BOOKS", "اجمالي_النسخ");
                            if (int.Parse(comboBox44.Text) >= int.Parse(So_Exchange_Total_Add.Text))
                            {
                                TotalOfBook11.Text = Convert.ToString((int.Parse(comboBox44.Text)) - (int.Parse(So_Exchange_Total_Add.Text)));
                                LIB.update("UPDATE BOOKS SET اجمالي_النسخ=" + TotalOfBook11.Text + " where كود_الكتاب='" + So_Exchange_BookCode_Add.Text + "'");
                                label197.Text = "";
                                dataGridView1.ClearSelection();
                                LIB.insert("insert into [alssafa].[dbo].[So_Exchange] values ('" + So_Exchange_Date_Add.Text + "','" + So_Exchange_NameOf_Add.Text + "','" + So_Exchange_BookCode_Add.Text + "'," + So_Exchange_Carton_Add.Text + "," + So_Exchange_Paking_Add.Text + "," + So_Exchange_Total_Add.Text + ");");
                                LIB.GridDisplay(dataGridView1, "So_Exchange", "select * from So_Exchange");
                                //SO_ADDED_NUM_Add.Clear();
                                So_Exchange_NameOf_Add.Clear();
                                So_Exchange_Paking_Add.Clear();
                                So_Exchange_Carton_Add.Clear();
                                LIB.ComboDisplay(So_Exchange_BookName_Add, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
                                So_Exchange_BookName_Add.Text = "اختر الكتاب";
                                So_Exchange_BookCode_Add.Text = "كود الكتاب";

                            }
                            else
                                label197.Text = "هذه الكمية غير متوفرة";


                        }
                        else
                            label197.Text = "أدخل عدد الكراتين";
                    }
                    else
                        label197.Text = "أدخل تعبئة الكرتونة";
                }
                else
                    label197.Text = "أدخل اسم الجهة المنصرف اليها";

            }
            else
                label197.Text = "اختر اسم الكتاب";
            

        }

        private void So_Exchange_BookName_Add_SelectedIndexChanged(object sender, EventArgs e)
        {

            LIB.ComboDisplayChoose(CodeBookCheck1, "Select * from BOOKS where إسم_الكتاب = " + "'" + So_Exchange_BookName_Add.Text + "'", "BOOKS", "كود_الكتاب", So_Exchange_BookCode_Add);
        }

        private void tabControl1_Click(object sender, EventArgs e)
        {
            label173.Text = "";
            label191.Text = "";
            label197.Text = "";
            SO_ADDED_BookName_Add.Text = "اختر الكتاب";
            SO_ADDED_SupplayerName_Add.Text = "اختر المورد";
            So_Exchange_BookName_Add.Text = "اختر الكتاب";
        }

        private void tabPage6_Enter(object sender, EventArgs e)
        {
            LIB.ComboDisplay(So_Exchange_BookName_Add, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            So_Exchange_BookName_Add.Text = "اختر الكتاب";
            So_Exchange_BookCode_Add.Text = "كود الكتاب";
        }

        private void tabPage22_Click(object sender, EventArgs e)
        {

        }

        private void tabPage22_Enter(object sender, EventArgs e)
        {
            label197.Text = "";
            So_Exchange_NameOf_Add.Clear();
            So_Exchange_Paking_Add.Clear();
            So_Exchange_Carton_Add.Clear();
            So_Exchange_Total_Add.Clear();
            LIB.ComboDisplay(So_Exchange_BookName_Add, "select إسم_الكتاب from alssafa.dbo.BOOKS ", "BOOKS", "إسم_الكتاب");
            So_Exchange_BookName_Add.Text = "اختر الكتاب";
            So_Exchange_BookCode_Add.Text = "كود الكتاب";
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            AccountSettings AS = new AccountSettings(User);
            AS.ShowDialog();
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ModifyData MD = new ModifyData(User);
            MD.ShowDialog();
        }

        private void tabPage18_Enter_1(object sender, EventArgs e)
        {
            LIB.ComboDisplay(VolumesName_Edit, "select إسم_المجلد from alssafa.dbo.Volumes ", "Volumes", "إسم_المجلد");
            VolumesName_Edit.Text = "اختر المجلد";
            VolumesCode_Edit.Text = "كود المجلد";
            VolumesAddress_Edit.Text = "";
            VolumesPhone_Edit.Text = "";
            VolumesEMAIL_Edit.Text = " ";
            VolumesFAX_Edit.Text = "";
        }

        private void button7_Click(object sender, EventArgs e)
        {
            CodeSuppliers_1_Add.Clear();
            SuppliersName_Add.Clear();
            SuppliersAddress_Add.Clear();
            SuppliersPhone_Add.Clear();
            SuppliersFAX_Add.Clear();
            SuppliersEMAIL_Add.Clear();
        }

        private void button8_Click(object sender, EventArgs e)
        {
            CodeVolumes_Add.Clear();
            VolumesNmae_Add.Clear();
            VolumesAddress_Add.Clear();
            VolumesPhone_Add.Clear();
            VolumesFAX_Add.Clear();
            VolumesEMAIL_Add.Clear();
        }

        private void SSN_ADD_TextChanged(object sender, EventArgs e)
        {

        }

        private void SSN_ADD_KeyPress(object sender, KeyPressEventArgs e)
        {

            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام...قم بادخال الرقم القومى مرة اخرى");
                e.Handled = true;
            }
        }

        private void Name_ADD_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsDigit(e.KeyChar) == true)
            {
                MessageBox.Show("لأ يمكنك  إدخال أرقام... قم بادخال الاسم الثلاثى مرة أخرى");
                e.Handled = true;
            }

        }

        private void Address_ADD_KeyPress(object sender, KeyPressEventArgs e)
        {
           
        }

        private void Salary_ADD_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال ... أرقام قم بادخال المرتب مرة اخرى");
                e.Handled = true;
            }
        }

        private void PhoneNumber_ADD_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم التيلفون مرة اخرى");
                e.Handled = true;
            }
        }

        private void Email_ADD_KeyPress(object sender, KeyPressEventArgs e)
        {
            //if (char.IsDigit(e.KeyChar) == true)
            //{
            //    MessageBox.Show("لأ يمكنك  إدخال أرقام قم بادخال الايميل مرة أخرى");
            //    e.Handled = true;
            //}
        }

        private void Phone_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {

            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم التيلفون  مرة اخرى");
                e.Handled = true;
            }
        }

        private void Address_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            
        }

        private void Email_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            //if (char.IsDigit(e.KeyChar) == true)
            //{
            //    MessageBox.Show("لأ يمكنك  إدخال أرقام قم بادخال الايميل مرة أخرى");
            //    e.Handled = true;
            //}
        }

        private void Salary_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال المرتب  مرة اخرى");
                e.Handled = true;
            }
        }

        private void CodeBook_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            
        }

        private void BookName_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            //if (char.IsDigit(e.KeyChar) == true)
            //{
            //    MessageBox.Show("لأ يمكنك  إدخال أرقام قم أسم الكتاب مرة أخرى");
            //    e.Handled = true;
            //}
        }

        private void AuthorName_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsDigit(e.KeyChar) == true)
            {
                MessageBox.Show("لأ يمكنك إدخال أرقام قم بادخال أسم المؤلف مرة أخرى");
                e.Handled = true;
            }
        }

        private void Cost_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال سعر الكتاب مرة اخرى");
                e.Handled = true;
            }
        }

        private void Packing_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال تعبئة الكرتونة مرة اخرى");
                e.Handled = true;
            }
        }

        private void NUN_Carton_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال عدد الكراتين مرة اخرى");
                e.Handled = true;
            }
        }

        private void Cost_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال سعر الكتاب مرة اخرى");
                e.Handled = true;
            }
        }

        private void Packing_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال تعبئة الكرتونة مرة اخرى");
                e.Handled = true;
            }
        }

        private void NUN_Carton_Delete_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال عدد الكراتين مرة اخرى");
                e.Handled = true;
            }
        }

        private void CodeSuppliers_1_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
           
        }

        private void Cost_Edit_TextChanged(object sender, EventArgs e)
        {

        }

        private void SuppliersName_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsDigit(e.KeyChar) == true)
            {
                MessageBox.Show("لأ يمكنك إدخال أرقام  قم بادخال أسم المورد مرة أخرى");
                e.Handled = true;
            }
        }

        private void SuppliersAddress_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
           
        }

        private void SuppliersPhone_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم التيلفون   مرة اخرى");
                e.Handled = true;
            }
        }

        private void SuppliersFAX_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم الفاكس  مرة اخرى");
                e.Handled = true;
            }
        }

        private void SuppliersEMAIL_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            //if (char.IsDigit(e.KeyChar) == true)
            //{
            //    MessageBox.Show("لأ يمكنك إدخال أرقام  قم بادخال الايميل مرة أخرى");
            //    e.Handled = true;
            //}
        }

        private void SuppliersAddress_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            
        }

        private void SuppliersPhone_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم التيلفون  مرة اخرى");
                e.Handled = true;
            }
        }

        private void Suppliers_Email_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            //if (char.IsDigit(e.KeyChar) == true)
            //{
            //    MessageBox.Show("لأ يمكنك إدخال أرقام  قم بادخال الايميل مرة أخرى");
            //    e.Handled = true;
            //}
        }

        private void SuppliersFAX_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم الفاكس  مرة اخرى");
                e.Handled = true;
            }
        }

        private void CodeVolumes_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            
        }

        private void VolumesNmae_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsDigit(e.KeyChar) == true)
            {
                MessageBox.Show("لأ يمكنك إدخال أرقام  قم بادخال أسم المجلد مرة أخرى");
                e.Handled = true;
            }
        }

        private void VolumesAddress_Add_KeyPress(object sender, KeyPressEventArgs e)
        {

           
        }

        private void VolumesPhone_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم التيلفون  مرة اخرى");
                e.Handled = true;
            }
        }

        private void VolumesFAX_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم الفاكس مرة اخرى");
                e.Handled = true;
            }
        }

        private void VolumesEMAIL_Add_KeyPress(object sender, KeyPressEventArgs e)
        {

            //if (char.IsDigit(e.KeyChar) == true)
            //{
            //    MessageBox.Show("لأ يمكنك إدخال أرقام  قم بادخال الايميل مرة أخرى");
            //    e.Handled = true;
            //}
        }

        private void VolumesAddress_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            
        }

        private void VolumesPhone_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم التيلفون مرة اخرى");
                e.Handled = true;
            }
        }

        private void VolumesEMAIL_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            //if (char.IsDigit(e.KeyChar) == true)
            //{
            //    MessageBox.Show("لأ يمكنك  إدخال أرقام قم بادخال الايميل مرة أخرى");
            //    e.Handled = true;
            //}
        }

        private void VolumesFAX_Edit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال رقم الفاكس مرة اخرى");
                e.Handled = true;
            }
        }

        private void SO_ADDED_Packing_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال تعبئة الكرتونة مرة اخرى");
                e.Handled = true;
            }
        }

        private void SO_ADDED_Carton_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال عدد الكراتين مرة اخرى");
                e.Handled = true;
            }
        }

        private void So_Exchange_Paking_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال تعبئة الكرتونة مرة اخرى");
                e.Handled = true;
            }
        }

        private void So_Exchange_Carton_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                MessageBox.Show("يمكنك فقط إدخال أرقام قم بادخال عدد الكراتين مرة اخرى");
                e.Handled = true;
            }
        }

        private void So_Exchange_NameOf_Add_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsDigit(e.KeyChar) == true)
            {
                MessageBox.Show("لأ يمكنك  إدخال أرقام قم بادخال اسم الجهة مرة أخرى");
                e.Handled = true;
            }
        }

        private void rectangleShape1_Click(object sender, EventArgs e)
        {

        }

        private void button9_Click(object sender, EventArgs e)
        {
            int number = 0;
            if (int.TryParse(SO_ADDED_NUM_Print.Text, out number))
            {
                label201.Text = "";
                string No_SO_ADDED;
                No_SO_ADDED = SO_ADDED_NUM_Print.Text;
                PrintSO_ADDED PSA = new PrintSO_ADDED(No_SO_ADDED);
                PSA.ShowDialog();
            }
            else
                label201.Text = "أدخل رقم الإذن الصحيح";
        }

        private void button10_Click(object sender, EventArgs e)
        {
            int number = 0;
            if (int.TryParse(So_Exchange_NUM_Print.Text, out number))
            {
                label204.Text = "";

                            label204.Text = "";
                            string No_SO_Exchange;
                            No_SO_Exchange = So_Exchange_NUM_Print.Text;
                            PrintSo_Exchange PSE = new PrintSo_Exchange(No_SO_Exchange);
                            PSE.ShowDialog();

            }
            else
                label204.Text = "أدخل رقم الإذن الصحيح";
        }

        private void button11_Click(object sender, EventArgs e)
        {
            SalesEmployees SE = new SalesEmployees();
            SE.ShowDialog();
        }

        private void button12_Click(object sender, EventArgs e)
        {
            TotalSales TS = new TotalSales();
            TS.ShowDialog();
        }

        private void So_Exchange_NUM_Delete_TextChanged(object sender, EventArgs e)
        {
            So_Exchange_Date_Delete.Clear();
            So_Exchange_BookCode_Delete.Clear();
            So_Exchange_NameOf_Delete.Clear();
            So_Exchange_Paking_Delete.Clear();
            So_Exchange_Carton_Delete.Clear();
            So_Exchange_Total_Delete.Clear();
            label190.Text = "";
        }

        private void CodeSuppliers_1_Delete_TextChanged(object sender, EventArgs e)
        {
            label206.Text = "";
        }

        private void VolumesCode_Delete_TextChanged(object sender, EventArgs e)
        {
            label207.Text = "";
        }

        private void CodeSuppliers_1_Edit_TextChanged(object sender, EventArgs e)
        {
            label199.Text = "";
        }

        private void CodeBook_Edit_TextChanged(object sender, EventArgs e)
        {
            label196.Text = "";
        }

        private void SuppliersAddress_Add_TextChanged(object sender, EventArgs e)
        {

        }

        private void SuppliersEMAIL_Add_TextChanged(object sender, EventArgs e)
        {

        }










    
    
    }
}
